# include"rclcpp/rclcpp.hpp"


class PersonNode : public rclcpp::Node
{
    private:
        std::string name_;
        int age_;
    public:
        PersonNode(const std::string &node_name, const int &age,const std::string &name):Node(node_name)
        {
            this->name_ = name;
            age_ = age;
        }
        void eat(const std::string &food_name){
            RCLCPP_INFO(this->get_logger(),"我是%s ，已经%d岁，正在吃 %s",this->name_.c_str(),this->age_,food_name.c_str());
        }
   
};
int main(int args,char **argv){

    rclcpp::init(args,argv);
    auto person = std::make_shared<PersonNode>("person_node",18,"小明");  //创建节点
    RCLCPP_INFO(person->get_logger(),"创建节点成功");
    person->eat("苹果");
    rclcpp::spin(person);
    rclcpp::shutdown();
}